Public Member Functions | |
void | run () |
Package Functions | |
ButtonThreadJvn1 (Irc i, ButtonType b) | |
Private Attributes | |
Irc | irc |
ButtonType | button |
Definition at line 146 of file Irc.java.
irc.ButtonThreadJvn1.ButtonThreadJvn1 | ( | Irc | i, | |
ButtonType | b | |||
) | [package] |
Constructor: initialized the ButtonThread.
i | IRC class to use. | |
b | Which button has been pressed. |
Definition at line 156 of file Irc.java.
References irc.ButtonThreadJvn1.button, and irc.ButtonThreadJvn1.irc.
void irc.ButtonThreadJvn1.run | ( | ) |
Starts the thread.
Definition at line 166 of file Irc.java.
References irc.ButtonThreadJvn1.button, irc.Irc.data, jvn.JvnException.getMessage(), irc.ButtonThreadJvn1.irc, jvn.JvnObject.jvnGetObjectState(), jvn.JvnObject.jvnLockRead(), jvn.JvnObject.jvnLockWrite(), jvn.JvnObject.jvnUnLock(), irc.Irc.sentence, and irc.Irc.text.
00166 { 00167 try { 00168 if( button == ButtonType.Read || button == ButtonType.ReadAndUnlock ) { 00169 // lock the object in read mode 00170 irc.sentence.jvnLockRead(); 00171 00172 // invoke the method 00173 String s = ((Sentence)(irc.sentence.jvnGetObjectState())).read(); 00174 00175 // display the read value 00176 irc.data.setText(s); 00177 irc.text.append(s+"\n"); 00178 00179 if( button == ButtonType.ReadAndUnlock ) { 00180 // unlock the object 00181 irc.sentence.jvnUnLock(); 00182 } 00183 } else if( button == ButtonType.Unlock ) { 00184 // unlock the object 00185 irc.sentence.jvnUnLock(); 00186 } else if( button == ButtonType.Write || button == ButtonType.WriteAndUnlock ) { 00187 // get the value to be written from the buffer 00188 String s = irc.data.getText(); 00189 00190 // lock the object in write mode 00191 irc.sentence.jvnLockWrite(); 00192 00193 // invoke the method 00194 ((Sentence)(irc.sentence.jvnGetObjectState())).write(s); 00195 00196 if( button == ButtonType.WriteAndUnlock ) { 00197 // unlock the object 00198 irc.sentence.jvnUnLock(); 00199 } 00200 } 00201 } catch (JvnException je) { 00202 System.out.println("Javanaise error while processing IRC button action: " + je.getMessage()); 00203 } catch( Exception e ) { 00204 System.out.println( "Error while processing IRC button action: "+e); 00205 } 00206 }
Irc irc.ButtonThreadJvn1.irc [private] |
Definition at line 147 of file Irc.java.
Referenced by irc.ButtonThreadJvn1.ButtonThreadJvn1(), and irc.ButtonThreadJvn1.run().
ButtonType irc.ButtonThreadJvn1.button [private] |
Definition at line 148 of file Irc.java.
Referenced by irc.ButtonThreadJvn1.ButtonThreadJvn1(), and irc.ButtonThreadJvn1.run().